<?php
/**
  * 
  * @author wanghch
  * @email wanghch@mediav.com
  * @date Apr 19, 2013
  */
  
class ServiceController extends CController
{
	public function actionProduct()
	{
		$requestType = Yii::app()->request->requestType;
		switch($requestType){
			case 'GET':
				$pro = Product::model()->findAll(array('limit'=>10));
				$proList = array();
				foreach($pro as $p){
					$proList[] = array(
							'name'=>$p->name,
							'id'=>$p->id
					);
				}
				echo CJSON::encode($proList);
				break;
			case 'POST':
				break;
			case 'DELETE':
				break;
			case 'PUT':
				break;
		}	
	}
}